<template>
	<view>
		<uni-list v-for="(item,index) in data" :key="index">
			<uni-list-item :title="item.WorkMemo" :note="item.Run_CreateDate | formatDate"
				thumb="../../static/img/icon.png" thumbSize="lg" :rightText=" ''+item.Run_CreateUserName" clickable
				@click="btnDetails(item)"></uni-list-item>
		</uni-list>

		<u-empty v-show="show" mode="list" style="padding-top: 30vh;" icon="/static/img/empty.png">
		</u-empty>
		 
	</view>
</template>

<script>
	export default {
		data() {
			return {
				data: [],
				show: false
			}
		},
		onLoad(param) {
			const getPageData = this.$gl.uDecode(param.pageData);
			this.getData(getPageData.Name);
		},
		methods: {
			getData(param) {
				this.$api.myAjaxFunc(Config.PlatformAPI + publicJs.Config.WorkFlowRun.GetMyTaskDBGroupList, {
					SiteID: Common.Const.Site.SiteID,
					WorkName: param
				}).then((res) => {
					this.data = res.resultData;

					if (res.resultData.length == 0) {
						this.show = true;
					}

				})
			},
			btnDetails(param) {

				if (this.$gl.IsNullOrEmpty(param)) {
					this.$gl.toastFail("待办数据为空");
					return;
				}

				let pageData = {
					Key: param.Business_Key,
					Run_ID: param.Run_ID,
					Step_Handler_ID: param.Step_Handler_ID,
					title: param.WorkMemo,
				}

				const path = this.getPageUrl(param.PageUrl);

				this.$gl.setStorage(pageData, path);
			},
			getPageUrl(path) {
				let _path = "";
				if (!this.$gl.IsNullOrEmpty(path)) {
					_path = path.replace('/web', '/pages');
					_path = _path.split('.html')[0];
				}
				return _path;
			}
		}
	}
</script>

<style lang="scss" scoped>

</style>
